package net.knightwatch.kwtools.walkthrough.items;

import android.content.Context;
import android.graphics.Bitmap;
import android.util.Log;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class PhotoAnswer extends Answer {
	// Class for a photo answer type
	private static final String TAG = "PhotoAnswerType";
	private int answerType;
	private Long photoId;
	private String directions;
	private Bitmap photo;
	private Bitmap examplePhoto;
	ImageView answer;
	Button answerButton;
	
		
	public PhotoAnswer(){
		Log.d(TAG, "Created new Photo Answer Type");
		this.setAnswerTypeId(PHOTO_TYPE);
		directions = "Take Photo";
	}
	public Bitmap getPhoto() {
		return photo;
	}
	public void setPhoto(Bitmap photo) {
		// TODO Scale the image to a smaller size to be determined
		this.photo = photo;
		try{
			this.answer.setImageBitmap(photo);
		} catch (Exception e){
			Log.e(TAG, "Unable to set the image view is it not supposed to be?");
		}
	}
	public Long getPhotoId() {
		return photoId;
	}
	public void setPhotoId(Long photoId) {
		this.photoId = photoId;
	}
	public Bitmap getExamplePhoto() {
		return examplePhoto;
	}
	public void setExamplePhoto(Bitmap examplePhoto) {
		this.examplePhoto = examplePhoto;
	}
	public int getAnswerType() {
		return answerType;
	}
	public void setAnswerType(int answerType) {
		this.answerType = answerType;
	}
	public void setImageView(ImageView imageView){
		this.answer = imageView;
	}
	public ImageView getImageView(){
		return this.answer;
	}
	public Button getButton(){
		return this.answerButton;
	}
	@Override
	public LinearLayout getAnswerLayout(Context context) {
		LinearLayout answerLayout = new LinearLayout(context);
		// Photo Answer
		answer = new ImageView(context);
		answerButton = new Button(context);
		answerButton.setText(directions);
		answerLayout.addView(answer);
		answerLayout.addView(answerButton);
		return answerLayout;
	}
	@Override
	public String toString() {
		// TODO what to return when it is a photo answer. Must be string.
		return null;
	}
	public String getDirections() {
		return directions;
	}
	public void setDirections(String directions) {
		this.directions = directions;
	}
	@Override
	public void updateAnswerView() {
		// TODO Remove?
		
	}
	@Override
	public void setAnswerText(String answerText) {
		// not used by this object
	}
	
}
